//
//  BHSportTargetModel.swift
//  BigHealth
//
//  Created by 蔺百好 on 2021/8/26.
//

import UIKit

class BHSportTargetModel {
    var progress: String = "" // 进度
    var targetId: String = ""
    var plan: String = ""  // 计划
    var target: String = "" // 目标（标题）
    
    var clockStatus: Int = 0 // 当前打卡状态  0:待打卡  1:已打卡  2:缺卡  暂默认为 0 待打卡 直接跳转详情页面进行打卡
 
    fileprivate var progressInt: Int = 0
    func parseDic(_ dic: [String:Any]) {
        self.progress = BHJsonTool.decodeStringFromDic(dic: dic, key: "progress")
        self.targetId = BHJsonTool.decodeStringFromDic(dic: dic, key: "id")
        self.plan = BHJsonTool.decodeStringFromDic(dic: dic, key: "plan")
        self.target = BHJsonTool.decodeStringFromDic(dic: dic, key: "target")

        self.clockStatus = BHJsonTool.decodeIntFromDic(dic: dic, key: "clockStatus")
        self.progressInt = BHJsonTool.decodeIntFromDic(dic: dic, key: "progress")

    }
    
    lazy var progressWidth: CGFloat = {
        if self.progressInt == 0 {
            return 0
        }else {
            let scale = CGFloat(self.progressInt)/100.0
            return 120*scale
        }
    }()
}
